package com.manager.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;

/**
 * 机构
 * @author zlj
 *
 */
@SuppressWarnings("all")
@Entity
@Table(name = "tb_sys_org")
public class System_Organization extends AllId implements Serializable{

	private static final long serialVersionUID = 1L;
	
	private String pId;//父级机构id
	
	private String name;//机构名称

	private String description;//描述
	
	private System_User sys_user;//机构负责人

	//预留字段
	private String temp1;
	
	private String temp2;
	
	private String temp3;
	
	private List<System_User_Organization> listuo = new ArrayList<System_User_Organization>();

	private List<System_Organization_Permission> listop = new ArrayList<System_Organization_Permission>();
	
	public static String[] config = {"listuo","listop","sys_user"};

	@Column(name = "pid")
	public String getpId() {
		return pId;
	}

	public void setpId(String pId) {
		this.pId = pId;
	}

	@Column(name = "organizationName")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getTemp1() {
		return temp1;
	}

	public void setTemp1(String temp1) {
		this.temp1 = temp1;
	}

	public String getTemp2() {
		return temp2;
	}

	public void setTemp2(String temp2) {
		this.temp2 = temp2;
	}

	public String getTemp3() {
		return temp3;
	}

	public void setTemp3(String temp3) {
		this.temp3 = temp3;
	}

	@OneToMany(fetch = FetchType.LAZY,orphanRemoval=true, mappedBy = "sys_orga")
	public List<System_User_Organization> getListuo() {
		return listuo;
	}

	public void setListuo(List<System_User_Organization> listuo) {
		this.listuo = listuo;
	}

	@OneToMany(fetch = FetchType.LAZY,orphanRemoval=true, mappedBy = "sys_orga")
	public List<System_Organization_Permission> getListop() {
		return listop;
	}

	public void setListop(List<System_Organization_Permission> listop) {
		this.listop = listop;
	}

	@ManyToOne(fetch = FetchType.LAZY,cascade = CascadeType.PERSIST,optional=true)
	public System_User getSys_user() {
		return sys_user;
	}

	public void setSys_user(System_User sys_user) {
		this.sys_user = sys_user;
	}

	
}
